Posta a magia.
- Fórum
- OTServ
- Suporte
- Resolvidos
- [Resolvido] Knight spell ! Rep++
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

HELP
Editado Março 19 por wizav01
--<event type="statschange" name="SpellBuff" event="script" value="spellbuff.lua"/>-- --<event type="login" name="RegisterBuff" event="script" value="spellbuff.lua"/>-- local vocations = {4, 8} -- ID das vocations que receberao o buff local percentageToActive = 0.30 -- 30% local bonusSkill = 20 -- Quantidade de skill que o buff vai dar local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, -1) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, bonusSkill) setConditionParam(condition, CONDITION_PARAM_SUBID, 10) setConditionParam(condition, CONDITION_PARAM_BUFF, true) function onStatsChange(cid, attacker, type, combat, value) local health_now, health_max = getCreatureHealth(cid), getCreatureMaxHealth(cid) if (type == STATSCHANGE_HEALTHGAIN) then if (health_now + value) > math.ceil(health_max * percentageToActive) then doRemoveCondition(cid, CONDITION_ATTRIBUTES, 10) end elseif (type == STATSCHANGE_HEALTHLOSS) then if (health_now - value) > 0 and (health_now - value) < math.ceil(health_max * percentageToActive) then doAddCondition(cid, condition) end end return true end function onLogin(cid) if isInArray(vocations, getPlayerVocation(cid)) then registerCreatureEvent(cid, "SpellBuff") end return true end
Editado Março 23 por Woox
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

17 horas atrás, Woox disse:local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, -1) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 20) setConditionParam(condition, CONDITION_PARAM_SUBID, 10) setConditionParam(condition, CONDITION_PARAM_BUFF, true) function onStatsChange(cid, attacker, type, combat, value) local health_now, health_max = getCreatureHealth(cid), getCreatureMaxHealth(cid) if (type == STATSCHANGE_HEALTHGAIN) then if (health_now + value) > math.ceil(health_max * 0.30) then doRemoveCondition(cid, CONDITION_ATTRIBUTES, 10) end elseif (type == STATSCHANGE_HEALTHLOSS) then if (health_now - value) > 0 and (health_now - value) < math.ceil(health_max * 0.30) then doAddCondition(cid, condition) end end return true end
Aonde colocamos ela? globalevents? tem que registar no login?
como colocar pra enquanto o personagem ficar com 30% de hp ela ficar ativa?
se caso ele healar e ficar com + de 30% de hp essa "passiva" acabe?
Editado Março 20 por diarmaint
47 minutos atrás, diarmaint disse:Aonde colocamos ela? globalevents? tem que registar no login?
como colocar pra enquanto o personagem ficar com 30% de hp ela ficar ativa?
se caso ele healar e ficar com + de 30% de hp essa "passiva" acabe?
Tinha postado tarde, tava cansado pra explicar, é creaturescript. Editei o script e deixei esses dados configuráveis e já vai com login pra registrar, o buff já está funcionando desta maneira, ativa com -30% de life, acima disso é desativado.
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

8 minutos atrás, Woox disse:Tinha postado tarde, tava cansado pra explicar, é creaturescript. Editei o script e deixei esses dados configuráveis e já vai com login pra registrar, o buff já está funcionando desta maneira, ativa com -30% de life, acima disso é desativado.
o que mais eu poderia usar no lugar desse
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 20)
para outras vocações?
1 minuto atrás, diarmaint disse:o que mais eu poderia usar no lugar desse
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 20)para outras vocações?
CONDITION_PARAM_STAT_MAGICLEVEL
CONDITION_PARAM_SKILL_FIST
CONDITION_PARAM_SKILL_CLUB
CONDITION_PARAM_SKILL_SWORD
CONDITION_PARAM_SKILL_AXE
CONDITION_PARAM_SKILL_DISTANCE
CONDITION_PARAM_SKILL_SHIELD
Editado Março 20 por Woox
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

1 minuto atrás, Woox disse:CONDITION_PARAM_SKILL_FIST CONDITION_PARAM_SKILL_CLUB CONDITION_PARAM_SKILL_SWORD CONDITION_PARAM_SKILL_AXE CONDITION_PARAM_SKILL_DISTANCE CONDITION_PARAM_SKILL_SHIELD
Algo além de skills? tipo almento de dano ?
increasemagicpercent
1 minuto atrás, diarmaint disse:Algo além de skills? tipo almento de dano ?
increasemagicpercent
Não nesse caso, você pode encontrar os skills e stats que podem ser alterados na lib 000-constant.lua do seu servidor.
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

18 horas atrás, Woox disse:--<event type="statschange" name="SpellBuff" event="script" value="spellbuff.lua"/>-- --<event type="login" name="RegisterBuff" event="script" value="registerbuff.lua"/>-- local vocations = {4, 8} -- ID das vocations que receberao o buff local percentageToActive = 0.30 -- 30% local bonusSkill = 20 -- Quantidade de skill que o buff vai dar local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, -1) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, bonusSkill) setConditionParam(condition, CONDITION_PARAM_SUBID, 10) setConditionParam(condition, CONDITION_PARAM_BUFF, true) function onStatsChange(cid, attacker, type, combat, value) local health_now, health_max = getCreatureHealth(cid), getCreatureMaxHealth(cid) if (type == STATSCHANGE_HEALTHGAIN) then if (health_now + value) > math.ceil(health_max * percentageToActive) then doRemoveCondition(cid, CONDITION_ATTRIBUTES, 10) end elseif (type == STATSCHANGE_HEALTHLOSS) then if (health_now - value) > 0 and (health_now - value) < math.ceil(health_max * percentageToActive) then doAddCondition(cid, condition) end end return true end function onLogin(cid) if isInArray(vocations, getPlayerVocation(cid)) then registerCreatureEvent(cid, "SpellBuff") end end
Então vou deixar o xml como
spellbuff.lua
dai eu mudei a vocação e pronto, to usando 0.4 e não aconteceu nada..
4 horas atrás, diarmaint disse:Então vou deixar o xml como
spellbuff.luadai eu mudei a vocação e pronto, to usando 0.4 e não aconteceu nada..
Deixei as tags as serem usadas no XML nas primeiras linhas do script. Você provavelmente configurou algo errado, o script está funcional.
info
Grupo: Visconde
Registrado: 09/08/10
Posts: 314
Reputação: +19
Char no Tibia: não tenho

Em 21/03/2019 em 04:13, Woox disse:Deixei as tags as serem usadas no XML nas primeiras linhas do script. Você provavelmente configurou algo errado, o script está funcional.
Desculpa pela burrice, pensei que as tags eram pra ficar dentro do script, igual vc postou. rsrs
EDIT.
@Woox deixei as tags assim
<event type="statschange" name="SpellBuff" event="script" value="diarmaint/passiva.lua"/> <event type="login" name="RegisterBuff" event="script" value="diarmaint/passiva.lua"/>
Não dá nenhum erro no console mas o personagem não loga, fica conectando..
e fica registrado no console
[20:4:41.940] Diarmaint has logged in.
[20:4:41.943] Diarmaint has logged out.
Editado Março 22 por diarmaint
Em 21/03/2019 em 11:52, diarmaint disse:Desculpa pela burrice, pensei que as tags eram pra ficar dentro do script, igual vc postou. rsrs
EDIT.
@Woox deixei as tags assim
<event type="statschange" name="SpellBuff" event="script" value="diarmaint/passiva.lua"/> <event type="login" name="RegisterBuff" event="script" value="diarmaint/passiva.lua"/>Não dá nenhum erro no console mas o personagem não loga, fica conectando..
e fica registrado no console
[20:4:41.940] Diarmaint has logged in. [20:4:41.943] Diarmaint has logged out.
Tinha esquecido 1 return true no login, editei o código de novo, testa ai.
info
Grupo: Diretor
Registrado: 12/05/12
Posts: 818
Reputação: +578
Gênero: Masculino
Char no Tibia: [ADM] Night




info
Grupo: Campones
Registrado: 14/09/16
Posts: 12
Reputação: 0
Gênero: Masculino
boa rapeize, alguem pode ajudar, como faço uma spell, que ela sejá apenas para o knight, ou vocation 4 - 8...
eu não quero escrever ela e ativar, quero que ela seja propria do personagem sem escrever nada sem ativar...
bom seguinte, quando o knight tiver com vida menor que 30% do total da vida dele... ele ganha + 20 de skill, axe sword e club... tem como alguém ajudar ?
lembrando, eu não quero ativar ela igual utito tempo, e não quero que tenha um tempo determinado, quero que seja do personagem... ta com -30% de life ele ganha skill...
agradeço desde já !
Editado Março 19 por wizav01
Mudança de plano